﻿<!DOCTYPE html>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<%@page isELIgnored="false"%>
<c:set var="rootpath" value="${pageContext.request.contextPath}"></c:set>
<html>

<head>
<meta name=”renderer” content=”webkit”>
<meta http-equiv=”X-UA-Compatible” content=”IE=edge,chrome=1” />
<meta charset="utf-8">
<title></title>

<!-- 网站logo -->
<link rel="shortcut icon" href="${rootpath }/img/logo/g1181_16X16.ico"
	type="image/x-icon">
<link rel="icon" href="${rootpath }/img/logo/g1181_16X16.ico"
	type="image/x-icon">

<link rel="stylesheet" type="text/css"
	href="${rootpath }/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="${rootpath }/css/blog.css" />
<script src="${rootpath }/js/jquery-3.0.0.min.js" type="text/javascript"
	charset="utf-8"></script>
<script src="${rootpath }/js/bootstrap.min.js" type="text/javascript"
	charset="utf-8"></script>
</head>

<!-- Just for debugging purposes. Don't actually copy these 2 lines! -->
<!--[if lt IE 9]><script src="${rootpath }/js/ie8-responsive-file-warning.js"></script><![endif]-->
<script src="${rootpath }/js/ie-emulation-modes-warning.js"></script>

<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
      <script src="${rootpath }/js/html5shiv.js"></script>
      <script src="${rootpath }/js/respond.min.js"></script>
    <![endif]-->
<script src="${rootpath }/js/ie10-viewport-bug-workaround.js"></script>

<body>

	<nav class="navbar navbar-default navbar-fixed-top" role="navigation">
		<div class="container">
			<div class="navbar-header">
				<a class="navbar-brand">当我在扯淡</a>
			</div>

			<div class="collapse navbar-collapse">
				<ul class="nav navbar-nav navbar-right">
					<li class="active"><a href="#">首页</a></li>
					<li><a href="suggest">吐槽</a></li>
					<li><a href="about">自画像</a></li>
					<li><a href="http://git.oschina.net/gitgj">oschina</a></li>
					<li><a href="pay">捐助</a></li>
				</ul>
			</div>
		</div>
	</nav>

	<div class="container" style="margin-top: 60px;">
		<div class="row">
			<div class="col-sm-8 blog-main">
				<c:forEach var="essay" items="${essays }">
					<div class="blog-post">
						<div class="blog-post-title">
							<a class="m-title" href="comment?id=${essay.id }">${essay.title}</a>
						</div>
						<p class="blog-post-meta">
							<fmt:formatDate value="${essay.time}" pattern="yyyy-MM-dd HH:mm" />
						</p>
						<div>${essay.content }</div>
						<div>
							<a class="m-info" href="comment?id=${essay.id }">评论：${essay. comment}</a>
							<%-- <span
								class="sep">·</span> 
								<a class="m-info" href="#">热度：${essay.reading }</a> --%>
						</div>
					</div>
					<hr />

				</c:forEach>
			</div>

			<div class="col-sm-3 col-sm-offset-1 blog-sidebar">

				<div class="sidebar-module sidebar-module-inset"
					style="margin-top: 50px;">
					<h4 style="margin-top: 10px">${ notice.title}</h4>
					<div>${notice.content }</div>
				</div>
				<div class="sidebar-module">
					<h4>开发中</h4>
					<ol class="list-unstyled">
						<li><a href="#">March 2014</a></li>
						<li><a href="#">February 2014</a></li>
						<li><a href="#">January 2014</a></li>
						<li><a href="#">December 2013</a></li>
						<li><a href="#">November 2013</a></li>
						<li><a href="#">October 2013</a></li>
						<li><a href="#">September 2013</a></li>
						<li><a href="#">August 2013</a></li>
						<li><a href="#">July 2013</a></li>
						<li><a href="#">June 2013</a></li>
						<li><a href="#">May 2013</a></li>
						<li><a href="#">April 2013</a></li>
					</ol>
				</div>
				<div class="sidebar-module">
					<h4>泰拉瑞亚专区</h4>
					<ol class="list-unstyled">
						<li><a href="terraria_map_download" target="_blank">游戏地图下载</a></li>
						<!-- <li><a href="terraria_db_download">数据备份到本地</a></li> -->
						<li><a href="#" data-toggle="modal" data-target="#myModal">上传维护地图</a></li>
					</ol>
				</div>
			</div>
		</div>
	</div>

	<!-- Modal -->
	<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
		aria-labelledby="myModalLabel" aria-hidden="true">
		<div class="modal-dialog">
			<div class="modal-content">
				<form id="uploadForm">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal">
							<span aria-hidden="true">&times;</span><span class="sr-only">Close</span>
						</button>
						<h4 class="modal-title" id="myModalLabel" >上传修改后的地图</h4>
					</div>
					<div class="modal-body">
						<input type="file" name="upload_map_file" id="upload_map_file" />
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">close</button>
						<button type="button" class="btn btn-primary"  onclick="doUpload()">Save</button>
					</div>
				</form>
			</div>
		</div>
	</div>

	<script type="text/javascript">
	function doUpload() {  
	     var formData = new FormData($( "#uploadForm" )[0]);
	     var obj = $("#upload_map_file" );

	     if($("#upload_map_file" ).val()==""){
	    	 alert("请选择文件");
	    	 return;
	     }
	     
	     $.ajax({  
	          url: 'terraria_upload_map' ,  
	          type: 'POST',  
	          data: formData,  
	          async: false,  
	          cache: false,  
	          contentType: false,  
	          processData: false,  
	          success: function (returndata) {  
	        	  alert("上传成功");
	          },  
	          error: function (returndata) {  
	        	  alert("上传失败"); 
	          }  
	     }); 
	}  
	
	</script>

</body>

</html>